﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using KPIS.GERP.GFMS.APP.App_UI.Commons;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.BLL;
using KPIS.GERP.GFMS.MODEL;
namespace KPIS.GERP.GFMS.APP.App_UI.UserControls
{
    public partial class BGM_ProjectOperation : System.Web.UI.UserControl
    {
        IBLL_BGM_ProjectOperation op = new B_BGM_ProjectOperation();

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        public void LoadUserControl(string strSeq)
        {
            lblBgmProjOperSeq.Text = strSeq;
            LoadData();
        }

        public Label Get_lblBgmProjOperSeq()
        {
            return lblBgmProjOperSeq;
        }

        protected void LoadData()
        {
            M_BGM_ProjectOperation info = op.GetInfo(lblBgmProjOperSeq.Text);

            lblBgmProjOperCode.Text = info.bgm_proj_oper_code;
            lblBgmProjOperName.Text = info.bgm_proj_oper_name;
            lblBgmProjOperDescr.Text = info.bgm_proj_oper_descr;
            lblBgmProjOperDate.Text = (info.bgm_proj_oper_date == null ? "" : info.bgm_proj_oper_date.Value.ToShortDateString());
            lblStartDate.Text = (info.start_date == null ? "" : info.start_date.Value.ToShortDateString());
            lblEndDate.Text = (info.end_date == null ? "" : info.end_date.Value.ToShortDateString());
            lblJobsiteName.Text = info.m_hrm_mp_jobsites.job_site_name
                + "(" + info.m_hrm_mp_jobsites.name_short + ")";
            lblRecordStatusName.Text = info.record_status_name;

            Repeater1.DataBind();
            //lblOperAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblTransferAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblReserveAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblKeepAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblReqAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblPayAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblReturnAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
            //lblRemainAmount.Text = (info.sum_amount == null ? "0" : info.sum_amount.Value.ToString("#,###.####"));
        }

        protected void cmdDown_Click(object sender, ImageClickEventArgs e)
        {
            if (BGM_ProjectOperationExpense1.Get_lblBgmProjOperSeq().Text.Length == 0)
            {
                BGM_ProjectOperationExpense1.LoadUserControl(lblBgmProjOperSeq.Text);
            }

            cmdUp.Visible = true;
            cmdDown.Visible = false;
            BGM_ProjectOperationExpense1.Visible = true;
        }

        protected void cmdUp_Click(object sender, ImageClickEventArgs e)
        {
            cmdUp.Visible = false;
            cmdDown.Visible = true;
            BGM_ProjectOperationExpense1.Visible = false;
        }
    }
}